package com.example.mobile2021606129ly0401;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private ImageView imaLine;
    private Button button;

    private int[] Trun;
private  int TrunID=0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        initView();
        Trun = new  int[6];
        Trun[0]=R.drawable.line01_01;
        Trun[1]=R.drawable.line01_02;
        Trun[2]=R.drawable.line01_03;
        Trun[3]=R.drawable.line01_04;
        Trun[4]=R.drawable.line01_05;
        Trun[5]=R.drawable.line01_06;






 button.setOnClickListener(new View.OnClickListener() {
     @Override
     public void onClick(View v) {
              imaLine.setImageResource(Trun[TrunID+1]);
              TrunID+=1;



     }
 });



    }






    private void initView() {
        imaLine = (ImageView) findViewById(R.id.ima_line);
        button = (Button) findViewById(R.id.button);
    }
}